Skip to content

fix(gateway): identify local body buffer budget refusals - #406

Closed
fylorn wants to merge 1 commit into
mainfrom
codex/issue-403-body-budget-diagnostics
Closed

fylorn wants to merge 1 commit into
mainfrom
codex/issue-403-body-budget-diagnostics

Conversation

@fylorn

@fylorn fylorn commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Requests refused by the local body buffer budget currently look like upstream rate limits: both use HTTP 429 and x-thinkwatch-error: rate_limited. The refusal happens before routing and request history, so those records cannot explain it.

Log the budget snapshot captured at refusal in both body-reading and decompression paths, including Core version, stage, encoding and byte counts. Add x-thinkwatch-error-code so the specific gw.request.memory_busy cause is visible from response headers while preserving existing retry headers and client-specific JSON responses. Logs contain no body content, credentials or request URL.

Regression tests demonstrate that a large body can be repeatedly refused while smaller bodies fit, and that it succeeds after competing reservations are released. This change adds diagnosis; it does not change admission policy or establish the cause of the reported incident. Refs #403.

Validation:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo nextest run --workspace --profile ci: 4,506 passed, 16 skipped
  • cargo test --workspace --doc
  • ./scripts/smoke.sh: 87 passed, 0 failed

Rust compilation and tests used CARGO_INCREMENTAL=0.

Record an atomic budget snapshot at read and decompression refusals, and expose the detailed gateway error code without changing client retry semantics. Reproduce repeated large-body rejection under shared pressure and document why small requests and context compaction behave differently. Refs #403.
@fylorn fylorn closed this Nov 16, 2026
@fylorn
fylorn deleted the codex/issue-403-body-budget-diagnostics branch November 16, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant